package com.np.intentdemo1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    private EditText mViewEmail;
    private Button mButtonNext;

    public MainActivity() {
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mViewEmail = findViewById(R.id.view_email);
        mButtonNext = findViewById(R.id.button_next);

        mButtonNext.setOnClickListener(v -> {
            Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
            intent.putExtra("email", mViewEmail.getText().toString());
            startActivity(intent);
            finish();
        });
    }
}